package cn.iocoder.yudao.module.system.dal.mysql.chat;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.chat.ChatDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.chat.vo.*;

/**
 * 客服 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ChatMapper extends BaseMapperX<ChatDO> {

    default PageResult<ChatDO> selectPage(ChatPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ChatDO>()
                .betweenIfPresent(ChatDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ChatDO::getType, reqVO.getType())
                .eqIfPresent(ChatDO::getQrCode, reqVO.getQrCode())
                .likeIfPresent(ChatDO::getName, reqVO.getName())
                .eqIfPresent(ChatDO::getGoodPre, reqVO.getGoodPre())
                .eqIfPresent(ChatDO::getBadPre, reqVO.getBadPre())
                .eqIfPresent(ChatDO::getLevel, reqVO.getLevel())
                .orderByDesc(ChatDO::getId));
    }

}